package com.jlect.swebing.renderers.client;

/**
 * Contains all the information about the UI config of the application
 * @author Sergey Kozmin
 * @since 11.11.2007 16:03:35
 */
public class RenderersConfig {
    private static RenderersFactory renderersFactory = null;
    private static RendererEventProvider eventProvider = null;
    private static FontMetrix fontMetrix = null;

    public static RenderersFactory getRenderersFactory() {
        if(renderersFactory == null) {
            throw new IllegalStateException("Initialize default renderers factory first. ");
        }
        return renderersFactory;
    }

    public static void setRenderersFactory(RenderersFactory defaultFactory) {
        RenderersConfig.renderersFactory = defaultFactory;
    }

    public static RendererEventProvider getEventProvider() {
        if(eventProvider == null) {
            throw new IllegalStateException("Initialize event provider first. ");
        }
        return eventProvider;
    }

    public static void setEventProvider(RendererEventProvider eventProvider) {
        RenderersConfig.eventProvider = eventProvider;
    }

    public static FontMetrix getFontMetrix() {
        if(fontMetrix == null) {
            throw new IllegalStateException("Initialize font metrix first. ");
        }
        return fontMetrix;
    }

    public static void setFontMetrix(FontMetrix fontMetrix) {
        RenderersConfig.fontMetrix = fontMetrix;
    }

    private RenderersConfig() {
    }
}
